-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[energidataservice] Add UoM support for energy prices #16070
[energidataservice] Add UoM support for energy prices #16070
Conversation
3f38ccd
to
338e57c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question.
...in/java/org/openhab/binding/energidataservice/internal/handler/EnergiDataServiceHandler.java
Show resolved
Hide resolved
338e57c
to
5e18d23
Compare
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
5e18d23
to
1249faa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
| spot-price | Number:EnergyPrice | Spot price in DKK or EUR per kWh | no | | ||
| grid-tariff | Number:EnergyPrice | Grid tariff in DKK per kWh. Only available when `gridCompanyGLN` is configured | no | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably add that - with the current implementations of CurrencyProvider
- only one currency can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, it seems I still don't fully understand even after your explanations in openhab/openhab-core#3503 (comment).
I ran some more extensive tests now:
State | Provider | Configuration | Result |
---|---|---|---|
0.33126001 kr./kWh | LocaleBasedCurrencyProvider | Denmark | 0.33126001 kr./kWh |
0.33126001 DKK/kWh | LocaleBasedCurrencyProvider | Denmark | java.lang.IllegalArgumentException: Invalid Quantity value: 0.33126001 DKK/kWh |
0.33126001 kr./kWh | LocaleBasedCurrencyProvider | Sweden | java.lang.IllegalArgumentException: Invalid Quantity value: 0.33126001 kr./kWh |
0.33126001 kr./kWh | FixedCurrencyProvider | DKK | 0.33126001 kr./kWh |
0.33126001 kr./kWh | FixedCurrencyProvider | EUR | 0.33126001 €./kWh |
0.33126001 DKK/kWh | FixedCurrencyProvider | DKK | java.lang.IllegalArgumentException: Invalid Quantity value: 0.33126001 DKK/kWh |
0.044770 €/kWh | FixedCurrencyProvider | DKK | java.lang.IllegalArgumentException: Invalid Quantity value: 0.044770 €/kWh |
0.044770 €/kWh | FixedCurrencyProvider | EUR | 0.044770 €/kWh |
I have one channel which can be configured as either DKK or EUR, and all other channels are DKK. I guess this cannot work with UoM because it's not possible mix currencies? Also it seems that it's not possible to use any currency other than the configured one, although I'm a bit confused why case 3 and 5 have different results?
Perhaps you can advise how to avoid IllegalArgumentException
? Can/should the binding check something before trying to update state with a specific currency that won't be accepted?
EDIT: @kaikreuzer - tagging you also since you have reviewed openhab/openhab-core#3503 - in case you'd be interested in this topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@J-N-K - I don't know if you are receiving notifications without being tagged explicitly, so just to be sure, please see above when you find time.
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Related to openhab/openhab-core#3503
Tested with latest snapshot and custom built org.openhab.core-4.1.0-SNAPSHOT.jar and org.openhab.core.config.core-4.1.0-SNAPSHOT.jar from main.